home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 8 / Amoszine 8 (Disk 2 of 3).adf / Powerbobs.lha / powerbobsv1.0 / examples / amal_psprites.asc < prev    next >
Text File  |  1995-07-04  |  2KB  |  94 lines

  1. Screen Open 0,320,200,16,L
  2. Load "df0:examples/demo.abk"
  3. Hide On 
  4. '
  5. 'Set up some simple Sprite images... 
  6. '
  7. For I=1 To 7
  8.    Cls 0
  9.    Circle 8,8,I
  10.    Get Sprite I,0,0 To 16,16
  11. Next 
  12. 'We are only using 16 Psprites, so set the maximum to 16.
  13. 'This will save some time, specially on 68000 based machines.
  14. '
  15. Psprite Max 16
  16. 'We've grabbed 16 colours circles, so set the Psprite engine in 16 colour
  17. 'mode. 
  18. '
  19. Set Psprite Colours 16
  20. '
  21. 'Convert the grabbed Sprites in bank 1 from normal format  
  22. 'to interleaved bitmap format. 
  23. '
  24. Convert Sprites 1
  25. Unpack 10 To 0
  26. '
  27. 'It is very important to set the normal Bob and Sprite updates to Off !
  28. '
  29. Update Off 
  30. '
  31. 'Don't bother about the AMAL setup, just for testing...
  32. '
  33. For I=0 To 14 Step 2
  34. A$="Let X=Z(120)+148;Let Y=Z(100)+Z(50)+50;Let R0=-1;Let R1=-1;Let A=Z(4)+2;"
  35. A$=A$+"Loop: P ;P;"
  36. A$=A$+"Let X=X+R0 ;"
  37. A$=A$+"If X>398 Jump Reset ;"
  38. A$=A$+"If X<148 Jump Reset ;"
  39. A$=A$+"Let A=A+R1;"
  40. A$=A$+"If A<2 Jump Image;"
  41. A$=A$+"If A>6 Jump Image;"
  42. A$=A$+"Jump Loop ;"
  43. A$=A$+"Reset: ;"
  44. A$=A$+"Let R0=R0*-1 ;"
  45. A$=A$+"Jump Loop ;"
  46. A$=A$+"Image: ;"
  47. A$=A$+"Let R1=R1*-1 ;"
  48. A$=A$+"Jump Loop ;"
  49. Amal I,A$
  50. Next 
  51. For I=1 To 15 Step 2
  52. A$="Let X=Z(220)+Z(15)+148; Let Y=Z(160)+Z(10)+50;Let R0=1;Let R1=1;Let A=Z(4)+2;"
  53. A$=A$+"Loop: P ;P;"
  54. A$=A$+"Let X=X+R0 ;"
  55. A$=A$+"If X>398 Jump Reset ;"
  56. A$=A$+"If X<148 Jump Reset ;"
  57. A$=A$+"Let A=A+R1;"
  58. A$=A$+"If A<2 Jump Image;"
  59. A$=A$+"If A>6 Jump Image;"
  60. A$=A$+"Jump Loop ;"
  61. A$=A$+"Reset: ;"
  62. A$=A$+"Let R0=R0*-1 ;"
  63. A$=A$+"Jump Loop ;"
  64. A$=A$+"Image: ;"
  65. A$=A$+"Let R1=R1*-1 ;"
  66. A$=A$+"Jump Loop ;"
  67. Amal I,A$
  68. Next 
  69. '
  70. 'Assign the Psprites to an Amal channel... 
  71. '
  72. For I=0 To 15
  73. Pchannel To Psprite I To I
  74. Next 
  75. '
  76. 'Let's go !
  77. '
  78. Amal On 
  79. Multi No 
  80. R=Execall(-132)
  81. ' Whe use 2 Pause instructions in the Amal progs, so synchronize it to 
  82. ' the same speed.
  83. Psync Every 2
  84. Repeat 
  85. ' Ok transfer the X/Y and A values to the Psprites and Update them on screen.  
  86. '  
  87.    Psync Psprite 0 To 15
  88.    Wait Vbl 
  89. Until Left Click
  90. R=Execall(-138)
  91. Multi Yes 
  92. Erase 1
  93. Erase 10
  94.